/*
 * Sound.c
 *
 * Created: 11/21/2013 12:07:44 PM
 *  Author: smhood
 */ 
#include <avr/io.h>
#include "open_interface.h"
#include "util.h"
#include "lcd.h"
int sound(void)
{
	lcd_init();
	lprintf("Testing..");
	
	//(60 / tempo * 64) = ticks in a base note.
	//notes can be found in the open interface data sheet on class site.
	
	oi_t *robot = oi_alloc();
	oi_init(robot);
	lprintf("Initialized..");
	
	int song_index = 1;
	int num_notes = 9;
	unsigned char notes[] = {64,64,0,64,60,64,67,0,55};
	unsigned char duration[] = {20,20,5,20,15,15,15,20,25}; //1/64th of a second
	
	int index = 1;
	
	oi_load_song(song_index, num_notes, notes, duration);
	oi_play_song(index);
	
}